<?php

use Biz\pockets\constInterface\ActivityInfo;
use Biz\service\activity\FullShipping as sFullShipping;
use Biz\tools\GoodsExposureLog;

/**
 * @deprecated
 */
class activityGoodsListAction extends ActionPlugin
{
    const USER_LEVEL = self::LEVEL_NOTHING;
    const PAGE_SIZE = 30;

    public function main()
    {
        $activityId = $this->getRequest()->getQuery('activity_id', 0);
        $typeId = $this->getRequest()->getQuery('type_id', ActivityInfo::ACTIVITY_TYPE_FULL_SHIPPING);
        $sortType = $this->getRequest()->getQuery('sort_type', 0);
        $provinceId = $this->getRequest()->getQuery('province_id', 0);
        $cityId = $this->getRequest()->getQuery('city_id', 0);
        $page = $this->getRequest()->getQuery('page', 1);
        $page = $page ? $page : 1;
        if ($activityId) {
            $areaCode = $cityId ? $cityId : $provinceId;
            $result = sFullShipping::getFullShippingGoodsByShippingId($activityId, $sortType, $page, self::PAGE_SIZE, $areaCode);
            $result = $result ? $result : [
                'list' => [],
                'is_over' => 1
            ];
            $this->setSuccess($result);
            GoodsExposureLog::addLog($this->getRequest(), $result, $activityId);
        } else {
            throw new Exception('参数错误');
        }

    }

}